package com.imooc.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;

import com.imooc.dao.UserDao;
import com.imooc.domain.User;
import com.imooc.utils.JDBCUtil;

public class UserDaoImpl implements UserDao {

	@Override
	public void regist(User user) throws SQLException {
		QueryRunner queryRunner = new QueryRunner(JDBCUtil.getDataSource());
		String sql = "insert into user values(?,?,?,?,?,?,?)";
		Object[] param = {user.getUid(), user.getUsername(), user.getPassword(),
				user.getNickname(), user.getEmail(), user.getState(), user.getCode()};
		queryRunner.update(sql, param);
	}

}
